package com.itheima.service;

import com.itheima.dao.UserMapper;
import com.itheima.pojo.User;
import com.itheima.util.SessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class UserService {
        public List<User> findUserByName(String keyword){
            //通过工具类拿到会话对象
            SqlSession sqlSession = SessionFactoryUtils.getSession();
            UserMapper userMapper = sqlSession.getMapper(UserMapper.class);

            //从数据库中拿到数据
            List<User> userList = userMapper.findUser(keyword);
            //返回集合
            return userList;
        }
}
